3.926 \(\int \frac{(a+i a \tan (e+f x))^2}{c-i c \tan (e+f x)} \, dx\)

Optimal. Leaf size=55 \[ -\frac{2 i a^2}{f (c-i c \tan (e+f x))}+\frac{i a^2 \log (\cos (e+f x))}{c f}-\frac{a^2 x}{c} \]

[Out]

-((a^2*x)/c) + (I*a^2*Log[Cos[e + f*x]])/(c*f) - ((2*I)*a^2)/(f*(c - I*c*Tan[e + f*x]))

________________________________________________________________________________________

Rubi [A]  time = 0.115864, antiderivative size = 55, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 31, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.097, Rules used = {3522, 3487, 43} \[ -\frac{2 i a^2}{f (c-i c \tan (e+f x))}+\frac{i a^2 \log (\cos (e+f x))}{c f}-\frac{a^2 x}{c} \]

Antiderivative was successfully verified.

[In]

Int[(a + I*a*Tan[e + f*x])^2/(c - I*c*Tan[e + f*x]),x]

[Out]

-((a^2*x)/c) + (I*a^2*Log[Cos[e + f*x]])/(c*f) - ((2*I)*a^2)/(f*(c - I*c*Tan[e + f*x]))

Rule 3522

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Di
st[a^m*c^m, Int[Sec[e + f*x]^(2*m)*(c + d*Tan[e + f*x])^(n - m), x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] &&
EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0] && IntegerQ[m] &&  !(IGtQ[n, 0] && (LtQ[m, 0] || GtQ[m, n]))

Rule 3487

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[1/(a^(m - 2)*b
*f), Subst[Int[(a - x)^(m/2 - 1)*(a + x)^(n + m/2 - 1), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x
] && EqQ[a^2 + b^2, 0] && IntegerQ[m/2]

Rule 43

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rubi steps

\begin{align*} \int \frac{(a+i a \tan (e+f x))^2}{c-i c \tan (e+f x)} \, dx &=\left (a^2 c^2\right ) \int \frac{\sec ^4(e+f x)}{(c-i c \tan (e+f x))^3} \, dx\\ &=\frac{\left (i a^2\right ) \operatorname{Subst}\left (\int \frac{c-x}{(c+x)^2} \, dx,x,-i c \tan (e+f x)\right )}{c f}\\ &=\frac{\left (i a^2\right ) \operatorname{Subst}\left (\int \left (\frac{1}{-c-x}+\frac{2 c}{(c+x)^2}\right ) \, dx,x,-i c \tan (e+f x)\right )}{c f}\\ &=-\frac{a^2 x}{c}+\frac{i a^2 \log (\cos (e+f x))}{c f}-\frac{2 i a^2}{f (c-i c \tan (e+f x))}\\ \end{align*}

Mathematica [B]  time = 1.50745, size = 130, normalized size = 2.36 \[ -\frac{a^2 (\cos (e+3 f x)+i \sin (e+3 f x)) \left (\cos (e+f x) \left (-i \log \left (\cos ^2(e+f x)\right )+4 f x+2 i\right )+\sin (e+f x) \left (-\log \left (\cos ^2(e+f x)\right )-4 i f x-2\right )-2 \tan ^{-1}(\tan (3 e+f x)) (\cos (e+f x)-i \sin (e+f x))\right )}{2 c f (\cos (f x)+i \sin (f x))^2} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + I*a*Tan[e + f*x])^2/(c - I*c*Tan[e + f*x]),x]

[Out]

-(a^2*(Cos[e + f*x]*(2*I + 4*f*x - I*Log[Cos[e + f*x]^2]) - 2*ArcTan[Tan[3*e + f*x]]*(Cos[e + f*x] - I*Sin[e +
 f*x]) + (-2 - (4*I)*f*x - Log[Cos[e + f*x]^2])*Sin[e + f*x])*(Cos[e + 3*f*x] + I*Sin[e + 3*f*x]))/(2*c*f*(Cos
[f*x] + I*Sin[f*x])^2)

________________________________________________________________________________________

Maple [A]  time = 0.025, size = 46, normalized size = 0.8 \begin{align*} 2\,{\frac{{a}^{2}}{cf \left ( \tan \left ( fx+e \right ) +i \right ) }}-{\frac{i{a}^{2}\ln \left ( \tan \left ( fx+e \right ) +i \right ) }{cf}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+I*a*tan(f*x+e))^2/(c-I*c*tan(f*x+e)),x)

[Out]

2/f*a^2/c/(tan(f*x+e)+I)-I/f*a^2/c*ln(tan(f*x+e)+I)

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: RuntimeError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^2/(c-I*c*tan(f*x+e)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError

________________________________________________________________________________________

Fricas [A]  time = 1.43316, size = 99, normalized size = 1.8 \begin{align*} \frac{-i \, a^{2} e^{\left (2 i \, f x + 2 i \, e\right )} + i \, a^{2} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )}{c f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^2/(c-I*c*tan(f*x+e)),x, algorithm="fricas")

[Out]

(-I*a^2*e^(2*I*f*x + 2*I*e) + I*a^2*log(e^(2*I*f*x + 2*I*e) + 1))/(c*f)

________________________________________________________________________________________

Sympy [A]  time = 1.46334, size = 56, normalized size = 1.02 \begin{align*} \frac{2 a^{2} \left (\begin{cases} - \frac{i e^{2 i f x}}{2 f} & \text{for}\: f \neq 0 \\x & \text{otherwise} \end{cases}\right ) e^{2 i e}}{c} + \frac{i a^{2} \log{\left (e^{2 i f x} + e^{- 2 i e} \right )}}{c f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))**2/(c-I*c*tan(f*x+e)),x)

[Out]

2*a**2*Piecewise((-I*exp(2*I*f*x)/(2*f), Ne(f, 0)), (x, True))*exp(2*I*e)/c + I*a**2*log(exp(2*I*f*x) + exp(-2
*I*e))/(c*f)

________________________________________________________________________________________

Giac [B]  time = 1.40319, size = 171, normalized size = 3.11 \begin{align*} -\frac{\frac{2 i \, a^{2} \log \left (\tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + i\right )}{c} - \frac{i \, a^{2} \log \left ({\left | \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + 1 \right |}\right )}{c} - \frac{i \, a^{2} \log \left ({\left | \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) - 1 \right |}\right )}{c} + \frac{-3 i \, a^{2} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{2} + 10 \, a^{2} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + 3 i \, a^{2}}{c{\left (\tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + i\right )}^{2}}}{f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^2/(c-I*c*tan(f*x+e)),x, algorithm="giac")

[Out]

-(2*I*a^2*log(tan(1/2*f*x + 1/2*e) + I)/c - I*a^2*log(abs(tan(1/2*f*x + 1/2*e) + 1))/c - I*a^2*log(abs(tan(1/2
*f*x + 1/2*e) - 1))/c + (-3*I*a^2*tan(1/2*f*x + 1/2*e)^2 + 10*a^2*tan(1/2*f*x + 1/2*e) + 3*I*a^2)/(c*(tan(1/2*
f*x + 1/2*e) + I)^2))/f